<?php //strip
/**
 * Class that implements photogallery model.
 * 
 * @package odPhotogalleryWpPlugin
 * @subpackage odPhotogalleryWpPlugin_Models
 * @author Ondrej Donek <ondrejd@gmail.com>
 * 
 * @todo We need to upgrade database table scheme!!!
 * 
 * Original scheme:
 * <code>
 * CREATE TABLE IF NOT EXISTS `wp_fotogalerie` (
 *   `ID` int(11) NOT NULL auto_increment,
 *   `folder` varchar(255) NOT NULL,
 *   `title` varchar(255) collate utf8_general_ci NOT NULL,
 *   `description` tinytext collate utf8_general_ci NOT NULL,
 *   `created` datetime NOT NULL default '0000-00-00 00:00:00',
 *   `deleted` tinyint(1) NOT NULL default '0',
 *   PRIMARY KEY  (`ID`)
 * ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci ;
 * </code>
 */
class odPhotogalleryWpPlugin_Models_Photogallery 
    extends odWpPlugin_Model_WithTrash
{
  /**
   * Construct photogallery model.
   * 
   * @global wpdb $wpdb
   * @return void
   */
  public function __construct()
  {
    if(defined('IS_UNITTESTING') && IS_UNITTESTING) {
      $wpdb = new wpdb(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);
    } else {
      global $wpdb;
    }
    
    parent::__construct(array(
      'tableName' => $wpdb->prefix . 'newsletter',
      'primaryColumn' => 'ID',
      'checkColumn' => 'title',
      'columns' => array(
	'ID' => array('type' => 'bigint', 'length' => 20, 'primary' => true),
	'folder' => array('type' => 'varchar', 'length' => 255, 'notnull' => true),
	'title' => array('type' => 'varchar', 'length' => 255, 'notnull' => true),
	'description' => array('type' => 'text'),
	'created' => array('type' => 'timestamp', 'notnull' => true, 'default' => 'CURRENT_TIMESTAMP'),
	'deleted' => array('type' => 'tinyint')
      )
    ));
  }
} // End of odPhotogalleryWpPlugin_Models_Photogallery
